home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Resource for Source: C/C++
/
Resource for Source - C-C++.iso
/
codelib6
/
v_08_11
/
8n11065b
< prev
next >
Wrap
Text File
|
1995-11-01
|
943b
|
36 lines
// npx.hpp - Non-Preemptive eXecutive Header
// Copyright 1990 by Cnapse
// Written by: M. de Champlain
#include "std.h"
#include "list.h"
typedef word *reg;
typedef enum { TERMINATED, READY, RUNNING, SUSPENDED } taskState;
class Task {
friend class StateQ;
friend class ReadyQ;
LINK n;
reg sp;
word *stackBase;
taskState state;
void (*taskStartingAddress)();
word stackSizeInBytes;
Task *self;
Task *parent;
void Schedule(void);
public:
Task(void (*task)(), word stackSize) { taskStartingAddress = task;
stackSizeInBytes = stackSize; }
Task *Start(void);
Task *Self(void);
Task *Parent(void);
void ReSchedule(void);
void Terminate(Task *id);
void Suspend(Task *id);
void Resume(Task *id);
};
extern Task *running;